﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace EcSalseManage.User_Control
{
    public partial class User_DateControl : System.Web.UI.UserControl
    {
        public string DateText;
        private string _css = "inputQry";
        public string _ScriptPath = "../Js/";
        public string _ImagePath = "..../images/";

        /// <summary>
        /// 日期脚本路径
        /// </summary>
        public string ScriptPath
        {
            get { return this._ScriptPath; }
            set { this._ScriptPath = value; }


        }

        /// <summary>
        /// 图片路径
        /// </summary>
        public string ImagePath
        {
            get { return this._ImagePath; }
            set { this._ImagePath = value; }
        }

        public bool Enable
        {
            get { return this.txtDate.Enabled; }
            set { this.txtDate.Enabled = value; this.imgSelect.Visible = value; }
        }

        public bool Enabled
        {
            get { return this.txtDate.Enabled; }
            set { this.txtDate.Enabled = value; this.imgSelect.Visible = value; }
        }

        /// <summary>
        /// 当前日期
        /// </summary>
        public string SelectDate
        {
            get { return this.txtDate.Text; }
            set { this.txtDate.Text = value; }

        }

        /// <summary>
        /// 当前日期
        /// </summary>
        public string Text
        {
            get { return this.txtDate.Text; }
            set { this.txtDate.Text = value; }
        }

        public string css
        {
            set
            {
                this._css = value;
            }
            get
            {
                return this.txtDate.CssClass;
            }
        }

        /// <summary>
        /// 只读
        /// </summary>
        public bool Read
        {
            set { this.txtDate.ReadOnly = value; this.imgSelect.Visible = !value; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.DateText = this.txtDate.ClientID.ToString();
            this.txtDate.CssClass = this._css;
            this.imgSelect.Attributes.Add("onclick", "ShowDateTime(" + this.DateText + ",'Date' );");
            this.imgSelect.ImageUrl = this._ImagePath + "Calendar.gif";
        }
    }
}